package net.xdclass.service;

import net.xdclass.controller.request.TrafficPageRequest;
import net.xdclass.controller.request.UseTrafficRequest;
import net.xdclass.model.EventMessage;
import net.xdclass.util.JsonData;
import net.xdclass.vo.TrafficVO;
import net.xdclass.model.TrafficDO;


import java.util.List;
import java.util.Map;

/**
 * 功能描述
 *
 * @author ASUS
 * @date 2024/12/10  8:48
 */
public interface TrafficService {
    void handleTrafficMessage(EventMessage eventMessage);

    Map<String, Object> pageAvailable(TrafficPageRequest request);

    TrafficVO detail(Long trafficId);

    boolean deleteExpiredTraffic();

    /**
     * 查找可⽤的短链流量包(未过期),包括免费流量包
     * @param accountNo
     * @return
     */
    List<TrafficDO> selectAvailableTraffics(Long accountNo);
    /**
     * 给某个流量包增加使⽤次数
     *
     * @param trafficId
     * @param accountNo
     * @param usedTimes
     * @return
     */
    int addDayUsedTimes(Long accountNo, Long trafficId, Integer usedTimes) ;
    /**
     * 恢复某个流量包使⽤当天次数
     * @param accountNo
     * @param trafficId
     * @param useTimes
     */
    int releaseUsedTimes(long accountNo, Long trafficId, Integer useTimes,String useDate);
    /**
     * 批量更新流量包使⽤次数为0
     * @param accountNo
     * @param unUpdatedTrafficIds
     */
    int batchUpdateUsedTimes(Long accountNo, List<Long> unUpdatedTrafficIds);

    JsonData reduce(UseTrafficRequest request);
}
